﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace _201206QuanLyBanHang.ChucNang
{
    class BLL_SanPham
    {
        DataConn da;
        public BLL_SanPham()
        {
            da = new DataConn();
        }
        public DataSet getDMSanPham(string strsql)
        {
            return da.ExectueQueryDataset(strsql, CommandType.Text, null);
        }
        public bool insertDMSanPham(ref string err, string masanpham, string tensanpham, double giasanpham, DateTime ngaysanpham, string ghichu)
        {
            return da.MyExecuteNonQuery("Pro_Insert_DMSanpham", CommandType.StoredProcedure, ref err, new SqlParameter("@masp", masanpham), new SqlParameter("@tensp", tensanpham), new SqlParameter("@giasp", giasanpham), new SqlParameter("@ngaygiasp", ngaysanpham), new SqlParameter("@ghichu",ghichu));
        }
        public bool deleteDMSanPham(ref string err, string masanpham)
        {
            return da.MyExecuteNonQuery("Pro_Delete_DMSanpham", CommandType.StoredProcedure, ref err, new SqlParameter("@masp", masanpham));
        }
        public bool updateDMDautu(ref string err, string masanpham, string tensanpham, double giasanpham, DateTime ngaysanpham, string ghichu)
        {
            return da.MyExecuteNonQuery("Pro_Update_DMSanpham", CommandType.StoredProcedure, ref err, new SqlParameter("@masp", masanpham), new SqlParameter("@tensp", tensanpham), new SqlParameter("@giasp", giasanpham), new SqlParameter("@ngaygiasp", ngaysanpham), new SqlParameter("@ghichu", ghichu));
        }
        public object layma(ref string err, string str)
        {
            return da.lay(str, CommandType.Text, ref err);
        }
    }
}
